<?php

namespace Database\Seeders;

use App\Models\System\Admin;
use Illuminate\Database\Seeder;

class AdminSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $count = Admin::query()->count();
        if ($count >= 2) {
            return;
        }
        $admin = Admin::factory()->create();
        $admin->username = 'admin';
        $admin->save();
        $admin->roles()->sync([1, 2]);

        $admin = Admin::factory()->disabled()->create();
        $admin->roles()->sync([2]);
    }
}
